import request from '@/utlis/request'
// 获取商品最新价格库存，是否有效
export const getNewCartGoods = (skuId) => {
  return request(`/goods/stock/${skuId}`, 'get')
}
// 获取商品对应的sku数据
export const getCartGoodsSku = (skuId) => {
  return request(`/goods/sku/${skuId}`, 'get')
}
// 合并购物车 [{skuId,selected,count}] skuid 选中状态 数量
export const metgeCart = (cartList) => {
  return request('/member/cart/merge', 'post', cartList)
}

// 获取购物车
export const getCartList = () => {
  return request('/member/cart', 'get')
}

// 加入购物车
export const addCartList = ({ skuId, count }) => {
  return request('/member/cart', 'post', { skuId, count })
}
// 删除购物车（单条，多条）ids数组传递删除的skuId[skuId0,skuId1....]
export const deleteCartList = (ids) => {
  return request('/member/cart', 'delete', { ids })
}
// skuId 选中状态 选中状态
// 修改商品
export const editCart = ({ skuId, selected, count }) => {
  return request(`/member/cart/${skuId}`, 'put', { selected, count })
}
//  修改 - 购物车全选 / 取消

export const isCheckAll = ({ selected, ids }) => {
  return request('/member/cart/selected', 'put', { selected, ids })
}
